<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link th:href="@{/bootsrap/bootstrap.css}" rel="stylesheet">
    <link th:href="@{/css/mystyle.css}" rel="stylesheet">
    <script th:src="@{/jquery/jquery-1.11.3.min.js}"></script>
    <script th:src="@{/jquery/bootstrap.min.js}"></script>

</head>
<body>
<div class="layui-layout layui-layout-admin" th:fragment="topbar">
    <div class="layui-header">
        <div class="layui-logo">layui 后台布局</div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item"><a href="/admin" >主页</a></li>
            <li class="layui-nav-item"><a href="/admin_users">用户管理</a></li>
            <li class="layui-nav-item"><a href="/root_admin">管理员管理</a></li>
            <li class="layui-nav-item">
                <a href="javascript:;">爬取视频</a>
                <dl class="layui-nav-child">
                    <dd><a href="">单个视频</a></dd>
                    <dd><a href="">网页爬取</a></dd>

                </dl>
            </li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
                    <span th:text="${session.admin.getAdminName()}"></span>
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="" style="background-color: #ffe2ed" data-toggle="modal" data-target="#infoModal">基本资料</a></dd>
                    <dd><a href="">安全设置</a></dd>
                    <dd><a href="/admin/logout">退出登录</a></dd>

                </dl>
        </ul>
    </div>
    <!-- 模态框（Modal） -->
    <div class="modal fade" id="infoModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">模态框（Modal）标题</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" id="adminForm" role="form" method="get">
                        <div class="form-group">
                            <label for="adminName" class="col-sm-2 control-label">名字</label>
                            <div class="col-sm-10">
                                <input type="text" th:value="${session.admin.getAdminName()}" name="adminName" class="form-control" id="adminName" placeholder="请输入名字">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="password" class="col-sm-2 control-label">密码</label>
                            <div class="col-sm-10">
                                <input type="text" name="password" th:value="${session.admin.getPassword()}" class="form-control" id="password" placeholder="请输入密码">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="email" class="col-sm-2 control-label">邮箱</label>
                            <div class="col-sm-10">
                                <input type="text" name="email" th:value="${session.admin.getEmail()}" class="form-control" id="email" placeholder="请输入邮箱">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="phone" class="col-sm-2 control-label">手机号码</label>
                            <div class="col-sm-10">
                                <input type="text" name="phone" th:value="${session.admin.getPhone()}" class="form-control" id="phone" placeholder="请输入手机号码">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="address" class="col-sm-2 control-label">地址</label>
                            <div class="col-sm-10">
                                <input type="text" name="address" th:value="${session.admin.getAddress()}" class="form-control" id="address" placeholder="请输入地址">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <button type="button"  data-dismiss="modal" class="btn btn-default">返回</button>
                                <button type="button" class="btn btn-default" onclick="adminUpdate()">修改</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>


    <script src="/layui/layui.all.js"></script>

    <script>
        //执行修改客户操作
        function adminUpdate() {
            //alert("jahnk");
            $.post("/admin/updateInfo",
                $("#adminForm").serialize(),
                function (data) {
                    if (data == "OK") {
                        alert("信息更新成功！");
                        window.location.reload();
                    } else {
                        alert("信息更新失败！");
                        window.location.reload();
                    }
                }
            )
        }
    </script>
</div>




</body>
</html>